package com.keter.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.ClientRegistrationException;

/**
 * Created by gulx@neusoft.com on 2020/6/1.
 */
public class MyClientDetailService implements ClientDetailsService {
    private static final Logger logger = LoggerFactory.getLogger(MyClientDetailService.class);

    @Override
    public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
        logger.info("---------- invoke MyClientDetailService! -----------");
        //不能使用依赖注入：因为框架调用loadClientByClientId方法时没使用容器方式。
        return ClientUserUtil.instance().retrieveClientDetails(clientId);
    }
}
